/*** Eclipse Class Decompiler plugin, copyright (c) 2012 Chao Chen (cnfree2000@hotmail.com) ***/
package com.qihoo.gamecenter.sdk.support.systemmessage.a;

import android.content.Context;
import android.text.TextUtils;
import com.qihoo.gamecenter.sdk.common.h.d;
import com.qihoo.gamecenter.sdk.common.h.d.a;
import com.qihoo.gamecenter.sdk.common.i.s;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import org.json.JSONArray;
import org.json.JSONObject;

public class b extends d {
    public b(Context paramContext, d.a parama) {
        super(paramContext, parama, false);
    }

    protected String a(Context paramContext, String[] paramArrayOfString) {
        String str1 = a(0, paramArrayOfString);
        String str2 = a(1, paramArrayOfString);
        String str3 = a(2, paramArrayOfString);
        if ((TextUtils.isEmpty(str1)) || (TextUtils.isEmpty(str3)))
            return null;
        if (TextUtils.isEmpty(str2))
            str2 = "0";
        TreeMap localTreeMap = new TreeMap();
        localTreeMap.put("app_key", s.r(paramContext));
        localTreeMap.put("user_id", str1);
        localTreeMap.put("last_id", str2);
        localTreeMap.put("dir", str3);
        String str4 = "http://msg.mgame.360.cn/msg/get_list.json?" + s.a(localTreeMap, s.s(paramContext));
        com.qihoo.gamecenter.sdk.support.g.a.a("GetSysMsgListTask", new Object[] { "req url = " + str4 });
        return str4;
    }

    protected String a() {
        return null;
    }

    protected Map b(Context paramContext, String[] paramArrayOfString) {
        return null;
    }

    protected a b(JSONObject paramJSONObject) {
        if (paramJSONObject != null) {
            a locala = new a();
            a.a(locala, paramJSONObject.optInt("error_code", -1));
            a.a(locala, paramJSONObject.optString("error"));
            a.a(locala, paramJSONObject.optInt("more", 0) == 1);
            try {
                JSONArray localJSONArray = paramJSONObject.optJSONArray("msgs");
                if (localJSONArray != null) {
                    int i = localJSONArray.length();
                    for (int j = 0; j < i; ++j) {
                        com.qihoo.gamecenter.sdk.support.systemmessage.a locala1 = new com.qihoo.gamecenter.sdk.support.systemmessage.a();
                        JSONObject localJSONObject = localJSONArray.getJSONObject(j);
                        locala1.a(localJSONObject);
                        a.a(locala).add(locala1);
                        if (locala1.e)
                            continue;
                        a.b(locala);
                        a.c(locala).add(locala1.a);
                    }
                }
            } catch (Exception localException) {
                com.qihoo.gamecenter.sdk.support.g.a.c("GetSysMsgListTask", new Object[] { localException.toString() });
            }
            return locala;
        }
        return null;
    }

    public static class a {
        private int a = -1;
        private String b;
        private int c = 0;
        private boolean d = false;
        private List e = new ArrayList();
        private HashSet f = new HashSet();

        public List a() {
            return this.e;
        }

        public String b() {
            int i = this.e.size();
            if (i > 0)
                return ((com.qihoo.gamecenter.sdk.support.systemmessage.a) this.e.get(i - 1)).a;
            return null;
        }

        public int c() {
            return this.c;
        }

        public boolean d() {
            return this.d;
        }

        public Set e() {
            return this.f;
        }
    }
}